package com.fyzk.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.fyzk.activity.lottery.basketball.fragment.BasketballWFBaseFragment;

/**
 * 商店详情adapter
 * 
 * @author
 * 
 */
public class TabPageIndicatorAdapter extends FragmentPagerAdapter {

	private BasketballWFBaseFragment[] fragmentList;
	private String[] titles;
	private FragmentManager fm;

	public TabPageIndicatorAdapter(FragmentManager fm, BasketballWFBaseFragment[] fList,
			String[] titles) {
		super(fm);
		this.fm = fm;
		fragmentList = fList;
		this.titles = titles;
	}

	@Override
	public int getItemPosition(Object object) {
		// TODO Auto-generated method stub
		return POSITION_NONE;
	}

	/**
	 * 设置标题
	 * 
	 * @param titles
	 */
	public void setTitles(String[] titles) {
		this.titles = titles;
	}


	@Override
	public Fragment getItem(int position) {
		Fragment fragment = fragmentList[position];
		return fragment;
		// return instantiateItem(container, position);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		if (fragmentList == null) {
			return 0;
		} else {
			return fragmentList.length;
		}
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return titles[position];
	}

}
